import re
from pyinstrument import Profiler

if __name__ == '__main__':
    profiiler = Profiler()
    profiiler.start()
    file = "D:\\日值txt文件\\DAY202007.txt"
    f = open(file, "r", encoding='utf-8')
    print(f.readline())
    with open(file, "r", encoding='utf-8') as f:
        infos = f.readlines()
    elements = re.findall(r'elements=(.*)&', infos[0])[0].split(',') # 第0个数据内，匹配所有的元素值
    dict_of_elements = {}
    number_of_elements = {}
    i = 0
    for e in elements:
        dict_of_elements[e] = []
        number_of_elements[i] = e
        i += 1
    # print(dict_of_elements)
    for info in infos[2:]:
        info = re.findall(r'[^\s]+', info)
        # print(info, len(info))
        for i in range(0, len(info)):
            dict_of_elements[ number_of_elements[i] ].append(info[i])

    # print(dict_of_elements)
    profiiler.stop()
    profiiler.print()

